
/*
 * UPSceneItemsInspector.java
 *
 * Created on 2011-04-11, 22:47:21
 */

package JET.UtilPanels;

import JET.Centers.ControlCenter;
import JET.Centers.Graphics.GUICenter;
import JET.Centers.Graphics.GUICenter.UtilTabs;
import JET.Frames.DataModels.DataModelsFactory;
import JET.Frames.DataModels.SceneItemsTreeModel;
import JET.Scene;
import JET.UtilPanels.Trees.SceneTree;
import JET.UtilPanels.Trees.SceneTreeCellRenderer;
import JET.mygui.UtilTabsPane.UtilTabsPaneTab;
import javax.swing.JTree;

/**
 *
 * @author 057Ry
 */
public class UPSceneItemsInspector extends javax.swing.JPanel  implements UtilTabsPaneTab {

    static final ControlCenter CC = ControlCenter.getInstance();

    /** Creates new form UPSceneItemsInspector */
    public UPSceneItemsInspector() {
        initComponents();
        sceneItemsTree.setCellRenderer(new SceneTreeCellRenderer());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        sceneItemsTree = new SceneTree();

        sceneItemsTree.setModel(DataModelsFactory.getSceneItemsTreeModel());
        jScrollPane1.setViewportView(sceneItemsTree);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
        );

        getAccessibleContext().setAccessibleName("Scene Items Inspector");
    }// </editor-fold>//GEN-END:initComponents

    public UtilTabs getId() {
        return GUICenter.UtilTabs.SceneItemsInspector;
    }

    public boolean isScrollable() {
        return true;
    }

        /**
     * Makes specified scene as active inspected in scene tree.
     * @param sceneName Name of a scene to inspect.
     */
    public void setScene(Scene scene) {
        SceneItemsTreeModel model = (SceneItemsTreeModel)sceneItemsTree.getModel();
        model.setScene(scene);
        model.fireWholeTreeChanged();

        getSceneItemsTree().setScene(scene);
    }
    
    public void updateSceneItemsTreeUI() {
        sceneItemsTree.updateUI();
    }

    public SceneTree getSceneItemsTree() {
        return (SceneTree) sceneItemsTree;
    }


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTree sceneItemsTree;
    // End of variables declaration//GEN-END:variables
}
